stockCanvas = null;

/*
*	Have the browser pick and acceptable redraw rate 
*/
window.requestAnimFrame = (function(callback){
    return window.requestAnimationFrame ||
    window.webkitRequestAnimationFrame ||
    window.mozRequestAnimationFrame ||
    window.oRequestAnimationFrame ||
    window.msRequestAnimationFrame ||
    function(callback){
        window.setTimeout(callback, 1000 / 60);
    };
})();
 
/*
*	Start animation sequence -- Only need to call once
*/
function Animate(){ 
    stockCanvas.DrawCanvas();
    requestAnimFrame(function(){
        Animate();
    });
}

/*
*	Create A Stock Canvas 
*/
function CreateCanvas(name){
	stockCanvas = new StockCanvas();
	stockCanvas.InitCanvas(name, 600, 800);
	//$(stockCanvas.name).offset({ top: window.innerHeight*0.25,
	//	left: window.innerWidth * 0.25  });
	Animate();
}

/*
*	Handle Canvas Resize
*/
function OnResize(){
	stockCanvas.SetSize(window.innerHeight * 0.5 , window.innerWidth * 0.5);
	$(stockCanvas.name).offset({ top: window.innerHeight*0.25,
		left: window.innerWidth * 0.25  });
}


